<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<style type="text/css">
	div{width:150px;height:200px;background-color:red;position:absolute; z-index: 0; text-align: center; line-height: 200px ;font-size: 40px; color: #fff;}
	span{width:260px; height:150px; background-color: yellow;position: absolute; z-index: 1; border: 1px solid #000; display: none;}
</style>
<body>
	<script type="text/javascript">
		var len = 12;
		var cen = Math.floor(len/2);
		var str = '';
		var aDiv = document.getElementsByTagName('div')
		var aSpan = document.getElementsByTagName('span')

		for (var i = 0; i < len; i++) {
			if (i<cen) {
				str += '<div style ="left:'+ (20+i*160) +'px">' + (i+1) + '</div>';
				str += '<span style="left:'+ (180+i*160) +'px;top:30px;">'+ '说明' + (i+1) +'</span>';
			}else{
				str += '<div style="left:'+ (20+(i-cen)*160) +'px;top:250px">'+(i+1)+'</div>';
				str += '<span style="left:'+ (180+(i-cen)*160) +'px;top:280px">'+ '说明' + (i+1) +'</span>';
			}
		};
		document.body.innerHTML = str;
		for (var i = 0; i < aDiv.length; i++) {
			aDiv[i].index = i;								//注意千万不要放事件里面
			aDiv[i].onmouseover = function(){
				aSpan[this.index].style.display = 'block';
			}
			aDiv[i].onmouseout = function (){
				aSpan[this.index].style.display = 'none';
			}
		};
	</script>
</body>
</html>